package demo;

public class computer{
    public void open()
    {
        System.out.println("打开电脑");
    }
    public void close()
    {
        System.out.println("关闭电脑");
    }

    public void openDevice(USB usb)
    {
        usb.openDevice();
        if(usb instanceof Mouse)
        {
            Mouse mouse=(Mouse) usb;
            mouse.click();
        }
        if(usb instanceof Keyborad)
        {
            Keyborad keyborad=(Keyborad) usb;
            keyborad.click();
        }
        usb.closeDevice();
    }
}
